﻿using System;


namespace QFramework.Pacman
{
	public class PacmanModel
	{

		public ModelProperty<int> Score = new ModelProperty<int>(0);
		
		public ModelProperty<int> Level = new ModelProperty<int>(0);
		
		public ModelProperty<int> Lives = new ModelProperty<int>(3);
		
	}


	public class ModelProperty<T>
	{
		public ModelProperty(T initValue = default(T))
		{
			mValue = initValue;
		}

		private T mValue = default(T);

		public T Value
		{
			get { return mValue; }
			set
			{
				if (!mValue.Equals(value))
				{
					mValue = value;
					OnValueChanged.Invoke(value);
				}
			}
		}

		public event Action<T> OnValueChanged = obj => { };
		
		
	}
}